package yb.ecp.fast.user.service.auth.handler;

public enum CustomerLoginErrorEnum {
    mobileBindError(50001, "该手机号码已绑定其他微信"),
    orgIdMissing(50002, "新增客户组织ID参数缺失"),
    storeIdMissing(50003, "新增客户主店ID参数缺失"),
    mobilePhoneMissing(50004, "手机号码为必须参数"),
    sourceError(50005, "客户来源方式不正确"),
    sysnBjError(50006, "向徐工配件同步失败"),
    dbError(50007, "数据库保存客户信息失败"),
    dbDuplicateKey(50008, "该主店下已经存在拥有该手机号的客户"),
    wxUnBindedError(50009, "微信未绑定客户"),
    wxIdNotExistsError(50010, "微信ID不存在"),
    customerDisableError(50011, "账户被停用"),
    wxMobileBindedError(50012, "该微信已绑定其他手机号"),
    wxMobileInsertError(50013, "手机号新增失败");

    private final Integer code;
    private final String description;

    CustomerLoginErrorEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public boolean validate(Integer code) {
        if (null == code) {
            return false;
        }
        for (CustomerLoginErrorEnum e : CustomerLoginErrorEnum.values()) {
            if (e.getCode().intValue() == code) {
                return true;
            }
        }
        return false;
    }

}
